
if ( CLIENT ) then
	SWEP.Author				= "CSE - Night-Eagle"
	SWEP.Contact			= "gmail sedhdi"
	SWEP.Purpose			= ""
	SWEP.Instructions		= ""
	SWEP.PrintName			= "CSE AUG"
	SWEP.Instructions		= "Hold use and right-click to change firemodes."
	SWEP.Slot				= 4
	SWEP.SlotPos			= 0
	SWEP.IconLetter			= "e"
	
	killicon.AddFont("cse_aug","CSKillIcons",SWEP.IconLetter,Color(255,80,0,255))
end

if ( SERVER ) then
	AddCSLuaFile( "shared.lua" )
end


SWEP.Base				= "cse_base_as"

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_rif_aug.mdl"
SWEP.WorldModel			= "models/weapons/w_rif_aug.mdl"
SWEP.HoldType = "ar2"

SWEP.Weight				= 5
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

SWEP.Primary.Sound			= Sound("Weapon_AUG.Single")
SWEP.Primary.Recoil			= 1.5
SWEP.Primary.Unrecoil		= 9
SWEP.Primary.Damage			= 19
SWEP.Primary.NumShots		= 1
SWEP.Primary.Cone			= 0.03
SWEP.Primary.ClipSize		= 801
SWEP.Primary.Delay			= 0.06 //Don't use this, use the tables below!
SWEP.Primary.DefaultClip	= 3200 //Always set this 1 higher than what you want.
SWEP.Primary.Automatic		= true //Don't use this, use the tables below!
SWEP.Primary.Ammo			= "smg1"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo			= "none"

//Firemode configuration

SWEP.IronSightsPos = Vector(5.99,-3,.985)
SWEP.IronSightsAng = Vector(2.4,1.9,45)

SWEP.data = {}
SWEP.mode = "auto" //The starting firemode
SWEP.data.newclip = false //Do not change this

SWEP.data.snipefov = 45

SWEP.data.semi = {}
SWEP.data.semi.Delay = .09
SWEP.data.semi.Cone = 0.01
SWEP.data.semi.ConeZoom = 0.006

SWEP.data.auto = {}
SWEP.data.auto.Delay = .09
SWEP.data.auto.Cone = 0.014
SWEP.data.auto.ConeZoom = 0.01

//End of configuration

function SWEP:SecondaryAttack()
	if self.Owner:KeyDown(IN_USE) then
		if self.mode == "semi" then
			self.mode = "auto"
		else
			self.mode = "semi"
		end
		self.data[self.mode].Init(self)
		
		if self.mode == "auto" then
			self.Weapon:SetNetworkedInt("csef",1)
		elseif self.mode == "semi" then
			self.Weapon:SetNetworkedInt("csef",3)
		end
	elseif SERVER then
		if self.Owner:GetFOV() == 90 then
			self.Owner:SetFOV(self.data.zoomfov,.3)
			self.ironsights = true
			self.data.scope = false
		elseif self.Owner:GetFOV() == self.data.zoomfov and self.data.snipefov > 0 then
			self.Owner:SetFOV(self.data.snipefov,.3)
			self.ironsights = false
			self.data.scope = true
		else
			self.Owner:SetFOV(90,.3)
			self.ironsights = false
			self.data.scope = false
		end
		self:SetIronsights(self.ironsights)
	else
		if not self.sniping then
			self.ironsights = true
			self.data.scope = false
			self.sniping = 1
		elseif self.sniping == 1 and self.data.snipefov > 0 then
			self.ironsights = false
			self.data.scope = true
			self.sniping = 2
		else
			self.ironsights = false
			self.data.scope = false
			self.sniping = false
		end
		self:SetIronsights(self.ironsights)
	end
end
